import { Injectable } from '@angular/core';
import { BaseService } from '../base/base.service';
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class OrderService extends BaseService {
  // 开始下单提交人数和备注信息
  public start$(data: { [propsName: string]: any }): Observable<any> {
    return this.post('front/order/start', data);
  }

  // 获取订单信息(几人及口味)
  public orderInfo$(tableId: string): Observable<any> {
    return this.get(`front/order/${tableId}`);
  }

  // 修改下单信息(几人及口味)
  public modifyOrderInfo$(data: { [propsName: string]: any }): Observable<any> {
    return this.post('front/order/change_info', data);
  }

  // 确认下单
  public confirmOrder$(data: { [propsName: string]: any }): Observable<any> {
    return this.post('front/order/confirm_order', data);
  }

  // 获取订单详情
  public confirmOrderDetails$(tableId: string): Observable<any> {
    return this.get(`front/order/order_info/${tableId}`);
  }
}
